<?php
	namespace Qzn\Controller;
	require_once('./Model/loginHandler.php');
	require_once('./Controller/fileUploadController.php');
	require_once('./View/loginView.php');
	require_once('./Controller/loginController.php');
	require_once('./Controller/registerController.php');
	require_once('./Controller/memberListController.php');
	require_once('./Model/database.php');
	require_once('./Model/DBConfig.php');
	require_once('./View/navigationView.php');
	require_once('./Model/Hash/hashConfig.php');
	require_once('./Model/Hash/PasswordHash.php');
	require_once('./Controller/profileController.php');
	require_once('./Controller/friendListController.php');
	require_once('./Model/profileHandler.php');
	require_once('./Controller/wallController.php');
	require_once('./Model/databaseQuery.php');
	
	class MasterController {
				
		/**
		 * MasterController
		 * @return string html
		 */
		public function DoControll() {
			$fuc = new FileUploadController();
			$lc = new LoginController();
			$lw = new \Qzn\View\LoginView();
			$db = new \Qzn\Model\Database();
			$dbc = new \Qzn\Model\DBConfig();
			$rc = new RegisterController();
			$mc = new MemberListController();
			$db->Connect($dbc);
			$lh = new \Qzn\Model\LoginHandler($db);
			$prc = new ProfileController();
			$flc = new FriendListController();
			$ph = new \Qzn\Model\ProfileHandler($db);
			$wc = new WallController();
			
			$body = "";
			
			$body .= $lc->DoControll($lh, $lw);
			
			if (\Qzn\View\NavigationView::IsRegistering()) {
				$body .= $rc->DoControll($lh, $db);
			} else if (\Qzn\View\NavigationView::IsViewingProfile()) {
				$body .= $prc->DoControll($lh, $db, $lw, $ph);
			} else if (\Qzn\View\NavigationView::IsViewingMembers()) {
				$body .= $mc->DoControll($lh, $db, $lw);
			} else if (\Qzn\View\NavigationView::IsViewingFriends()) {
				$body .= $flc->DoControll($db, $lh, $lw, $ph);
			} else if (\Qzn\View\NavigationView::IsUploadingPic()) {
				$body .= $fuc->DoControll($db, $lw, $lh);
			} else {
				$body .= $wc->DoControll($db, $lw, $lh, $ph);
			}
			
			$db->Close();
			
			return $body;
		}
	}
?>